package org.budo.mongo.spring.boot.util;

import java.net.UnknownHostException;

import org.springframework.boot.autoconfigure.mongo.MongoProperties;
import org.springframework.core.env.Environment;

import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;

/**
 * @author lmw
 * @see org.springframework.boot.autoconfigure.mongo.MongoProperties
 */
public class MongoUtil {
    public static MongoClient createMongoClient(MongoProperties properties, MongoClientOptions options, Environment environment) {
        try {
            return properties.createMongoClient(options, environment);
        } catch (UnknownHostException e) {
            throw new RuntimeException(e);
        }
    }
}